library(tidyverse)
library(readxl)
path = "Excel/650 Top 3 Across Columns.xlsx"
input = read_excel(path, range = "A1:E15")
test = read_excel(path, range = "G1:G6") %>% pull()
result = input %>%
summarise(across(everything(), ~ paste(sort(unique(na.omit(.)))[1:3], collapse = ", "))) %>%
as.list() %>%
unlist()
all.equal(result, test)
# [1] TRUEExcel BI - Excel Challenge 650
excel-challenges
excel-formulas
🔰 List the bottom 3 unique values across the columns.

Challenge Description
🔰 List the bottom 3 unique values across the columns.
Solutions
- Logic: Read the workbook ranges needed for the challenge; Aggregate or rank the data at the required grouping level.
- Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
- Areas for Improvement: The solution assumes the workbook layout and selected ranges remain stable, so any structural change in the sheet would require small adjustments.
- Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import pandas as pd
path = "650 Top 3 Across Columns.xlsx"
input = pd.read_excel(path, usecols="A:E", nrows=15)
test = pd.read_excel(path, usecols="G", nrows=5).values.flatten().tolist()
result = input.apply(lambda col: ', '.join(map(str, sorted(col.dropna().astype(int).unique())[:3]))).tolist()
print(result == test) # TrueThe Python version mirrors the same workbook logic with a concise, direct implementation.
Difficulty Level
Easy / Medium
The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.